<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
  <head>
    
    <%@ include file="/WEB-INF/include/meta.jsp"%>
    <%@ include file="/WEB-INF/include/css.jsp"%>
    
  </head>
  <!-- end header -->
  <body>
    <div class="page-group">
      <div class="page page-current">
        
        <header class="bar bar-nav fs-header-small">
          <a href="${ctx.host}/profile-online-agent" class="icon icon-left pull-left"></a>
          <h1 class="title">收支记录</h1>
        </header>
        
        <div class="content">
        
          <div class="agent-banner">
            <div class="row">
              <div class="col-50 text-center">
                <span class="word">奖励</span><br>
                <span class="amount" style="font-size:0.65rem;">剩余：<fmt:formatNumber value="${agent.kickbackTotal/100 - agent.withdrawingTotal/100}" maxFractionDigits="2" pattern="0.00"/></span><br/>
                <span class="amount" style="font-size:0.65rem;">总计：<fmt:formatNumber value="${agent.kickbackTotal/100}" maxFractionDigits="2" pattern="0.00"/></span>
              </div>
               <div class="col-50 text-center">
                <span class="word">提现</span><br>
                <span class="amount" style="font-size:0.65rem;">待提现：<fmt:formatNumber value="${agent.withdrawingTotal/100}" maxFractionDigits="2" pattern="0.00"/></span><br/>
                <span class="amount" style="font-size:0.65rem;">已提现：<fmt:formatNumber value="${agent.withdrawedTotal/100}" maxFractionDigits="2" pattern="0.00"/></span>
              </div>
            </div>
            <div class="row">
             
            </div>
          </div>          
          <!-- end agent banner -->
          <div class="list-block" style="margin: .5rem 0;">
            <p style="margin:1em;">
              <c:choose>
                <c:when test="${empty agent.account}">
                 <a href="#account-edit" class="button button-big button-success button-fill button-submit"  data-toggle="push" style="width:100%; color:#000;"> 请填写支付宝账号</a>
                </c:when>
                <c:otherwise>
                  <a href="#agent-withdraw" class="button button-big button-success button-fill button-submit" data-toggle="push" style="width:100%; background-color:#FDDD32;color:#000;">提现</a>
                </c:otherwise>
              </c:choose>
            </p>
          </div>
        
          <div class="list-block info-list-item" style="margin: 0.5rem 0;">
            <ul>
              <c:forEach var="record" items="${agentRecords}">
                <li>
                  <div class="item-content item-inner">
                    <div class="item-title">类型：${record.recordType.description}，金额：${record.offer/100}元，时间：<fmt:formatDate value="${record.time}" pattern="yyyy-MM-dd HH:mm:ss"/></div>
                  </div>
                </li>
              </c:forEach>
            </ul>

          </div>
          
          <!-- End banner -->
        </div>
        <!-- End Content -->
        
      </div>
    </div>
    
    <%@ include file="/WEB-INF/include/script.jsp"%>
    <d:resource type="script" root="${ctx.resource}/build" src="js/page/profile/profile-agent-record.js" />
    <script type="text/javascript">
      var jsConfig = JSON.parse('${wechatJsConfig}')
      require(['page/profile/profile-agent-record'], function(page) {
        page.init({
          jsConfig: jsConfig
        })
      })
    </script>
   
  </body>
</html>